package com.qsl.ssyx.client.activity;

import com.qsl.ssyx.model.activity.CouponInfo;
import com.qsl.ssyx.model.order.CartInfo;
import com.qsl.ssyx.vo.order.CartInfoVo;
import com.qsl.ssyx.vo.order.OrderConfirmVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@FeignClient("server-activity")
public interface ActivityFeignClient {


    @ApiOperation("根据商品Ids获取促销信息")
    @PostMapping("/api/activity/inner/getActivityInfoBySkuId")
    Map<Long, List<String>> getActivityInfoBySkuId(@ApiParam(value = "skuIds", required = true) @RequestBody List<Long> skuIdList);


    @ApiOperation("根据商品id和用户id获取优惠卷信息")
    @GetMapping("/api/activity/inner/getActivityInfoBySkuIdAndUserId/{skuId}/{userId}")
    Map<String, Object> getActivityInfoBySkuIdAndUserId(@ApiParam(value = "商品Id", required = true) @PathVariable Long skuId,
                                                        @ApiParam(value = "userId", required = true) @PathVariable Long userId);

    // 根据购物车商品和用户id,获取当前用户购物车商品的活动及优惠卷信息
//    @ApiOperation("根据购物车商品和用户id获取优惠卷和活动的信息")
//    @PostMapping("/api/activity/inner/findCartActivityAndCoupon/{userId}")
//    OrderConfirmVo findCartActivityAndCoupon(@RequestBody List<CartInfo> cartInfoList,
//                                             @ApiParam(value = "userId", required = true) @PathVariable Long userId);

    @ApiOperation("根据购物车商品和用户id获取优惠卷和活动的信息")
    @PostMapping("/api/activity/inner/findCartActivityAndCoupon/{userId}")
    public OrderConfirmVo findCartActivityAndCoupon(@RequestBody List<CartInfo> cartInfoList,
                                                    @ApiParam(value = "userId", required = true) @PathVariable Long userId);
    //    促销活动相关信息
    @ApiOperation("促销活动相关信息")
    @PostMapping("/api/activity/inner/findCartActivityList")
    List<CartInfoVo> findCartActivityList(@RequestBody List<CartInfo> cartInfoParamList);

    @ApiOperation("根据购物车商品和优惠卷id获取优惠卷信息")
    @PostMapping("/api/activity/inner/findRangeSkuIdList/{couponId}")
    CouponInfo findRangeSkuIdList(@RequestBody List<CartInfo> cartInfoList,
                                  @ApiParam(value = "couponId", required = true) @PathVariable Long couponId);

    @ApiOperation("根据用户id、优惠卷id、优惠卷与用户ID， 修改优惠卷状态-已使用")
    @GetMapping("inner/updateCouponInfoUseStatus/{couponId}/{userId}/{id}")
    boolean updateCouponInfoUseStatus(@ApiParam(value = "优惠卷id", required = true) @PathVariable Long couponId,
                                      @ApiParam(value = "用户id", required = true) @PathVariable Long userId,
                                      @ApiParam(value = "优惠卷与用户ID", required = true) @PathVariable Long id);
}
